{
struct vcpu *v;
- for_each_vcpu( d, v )
+ for_each_vcpu ( d, v )
unmap_vcpu_info(v);
if ( is_hvm_domain(d) )
return;
mfn = v->vcpu_info_mfn;
- unmap_domain_page_global( v->vcpu_info );
+ unmap_domain_page_global(v->vcpu_info);
v->vcpu_info = shared_info_addr(d, vcpu_info[v->vcpu_id]);
v->vcpu_info_mfn = INVALID_MFN;
if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
return -EINVAL;
- if ( mfn == INVALID_MFN ||
- v->vcpu_info_mfn != INVALID_MFN )
+ if ( v->vcpu_info_mfn != INVALID_MFN )
+ return -EINVAL;
+
+ /* Run this command on yourself or on other offline VCPUS. */
+ if ( (v != current) && !test_bit(_VPF_down, &v->pause_flags) )
return -EINVAL;
mfn = gmfn_to_mfn(d, mfn);
v->vcpu_info = new_info;
v->vcpu_info_mfn = mfn;
- /* make sure all the pointers are uptodate before setting pending */
+ /* Set new vcpu_info pointer /before/ setting pending flags. */
wmb();
- /* Mark everything as being pending just to make sure nothing gets
- lost. The domain will get a spurious event, but it can
- cope. */
+ /*
+ * Mark everything as being pending just to make sure nothing gets
+ * lost. The domain will get a spurious event, but it can cope.
+ */
vcpu_info(v, evtchn_upcall_pending) = 1;
for ( i = 0; i < BITS_PER_GUEST_LONG(d); i++ )
set_bit(i, vcpu_info_addr(v, evtchn_pending_sel));
- /* Only bother to update time for the current vcpu. If we're
+ /*
+ * Only bother to update time for the current vcpu. If we're
* operating on another vcpu, then it had better not be running at
- * the time. */
+ * the time.
+ */
if ( v == current )
update_vcpu_system_time(v);
*/
#define VCPUOP_register_vcpu_info 10 /* arg == struct vcpu_info */
struct vcpu_register_vcpu_info {
- xen_pfn_t mfn; /* mfn of page to place vcpu_info */
- uint32_t offset; /* offset within page */
+ uint64_t mfn; /* mfn of page to place vcpu_info */
+ uint32_t offset; /* offset within page */
+ uint32_t rsvd; /* unused */
};
typedef struct vcpu_register_vcpu_info vcpu_register_vcpu_info_t;
DEFINE_XEN_GUEST_HANDLE(vcpu_register_vcpu_info_t);